package com.app.piemoment.database;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SettingLoader {
	private static final String CONFIG = "settings";
	private static final String LIFE = "life";
	private static final String VALUE = "value";
	private static final String LOVE = "love";
	private static final String TOGETHER = "together";
	private static final String MID = "mid";
	
	
	public static boolean setLifeCheck(Context context,boolean isChecked) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		Editor edit = preferences.edit();
		edit.putBoolean(LIFE, isChecked);
		return edit.commit();
	}

	public static boolean setValueCheck(Context context,boolean isChecked) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		Editor edit = preferences.edit();
		edit.putBoolean(VALUE, isChecked);
		return edit.commit();
	}

	public static boolean setLoveCheck(Context context,boolean isChecked) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		Editor edit = preferences.edit();
		edit.putBoolean(LOVE, isChecked);
		return edit.commit();
	}

	public static boolean setTogetherCheck(Context context,boolean isChecked) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		Editor edit = preferences.edit();
		edit.putBoolean(TOGETHER, isChecked);
		return edit.commit();
	}

	public static boolean getLifeCheck(Context context) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		return preferences.getBoolean(LIFE, false);
	}

	public static boolean getValueCheck(Context context) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		return preferences.getBoolean(VALUE, false);
	}

	public static boolean getLoveCheck(Context context) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		return preferences.getBoolean(LOVE, false);
	}

	public static boolean getTogetherCheck(Context context) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		return preferences.getBoolean(TOGETHER, false);
	}

	public static boolean setMatchId(Context context, int mid) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		Editor edit = preferences.edit();
		edit.putInt(MID, mid);
		return edit.commit();
	}
	
	public static int getMatchId(Context context) {
		SharedPreferences preferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
		return preferences.getInt(MID, 0);
	}
}
